<%@page import="java.util.Iterator"%>
<%@page import="beans.Despesa"%>
<%@page import="java.util.ArrayList"%>
<%@page import="dao.DespesaDAO"%>
<%@page import="beans.Venda"%>
<%@page import="dao.VendaDAO"%>

<%  
    DespesaDAO despesaDAO = new DespesaDAO();
    VendaDAO vendaDAO = new VendaDAO();
    
    ArrayList<Despesa> dsps = despesaDAO.loadAll();
    ArrayList<Venda> vnds = vendaDAO.loadAll();
    
    Iterator despIt = dsps.iterator();
    Iterator vendIt = vnds.iterator();


%>
<!DOCTYPE html>
<html>
    <%@ include file="header.html" %>
    <body>
        <%@ include file="topo.jsp" %>
        <%@ include file="menu.jsp" %>

        <div id="content">
            <h2>Despesas</h2>
            <table border="0" cellspacing="2">
                <thead>
                    <tr>
                        <th>Data</th>
                        <th>Valor</th>
                    </tr>
                </thead>
                <tbody>
                    <% while (despIt.hasNext()) {
                            Despesa ds = (Despesa) despIt.next();
                     %>
                    <tr> 
                        <td><%= ds.getData() %></td>
                        <td>R$ <%=ds.getValor() %></td>
                      
                    </tr>
                    <% }%>
                </tbody>
            </table>
                
            <h2>Vendas</h2>
            <table border="0" cellspacing="2">
                <thead>
                    <tr>
                        <th>Data</th>
                        <th>Preco (kg)</th>
                    </tr>
                </thead>
                <tbody>
                    <% while (vendIt.hasNext()) {
                            Venda vnd = (Venda) vendIt.next();
                     %>
                    <tr> 
                        <td><%= vnd.getData() %></td>
                        <td>R$ <%=vnd.getPrecoKg() %></td>
                      
                    </tr>
                    <% }%>
                </tbody>
            </table>
                
                
        </div>

    </body>
</html>